<template>
    <div class="big-box">
        <div class="header">
            <img src="../../../../../assets/bigScreen/header3.png" alt="" />
            <div class="backBox" @click="goBack"></div>
        </div>
        <div class="backToBox">
            <div class="backTo" @click="gotoHome">
                <div>返回总窗口</div>
            </div>
            <div class="backTo" @click="backToOne">
                <div>返回上一页</div>
            </div>
        </div>
        <div class="centerBox">
            <div class="sreenTitle">经纪人</div>
            <div class="center" v-if="detail">

                <div class="contenBox">
                    <div class="contenBox-left">
                        <div class="contenBox-left-top" v-if="detail">
                            <!-- <img :src="detail.logo" v-if="detail.logo" alt=""> -->
                            <img :src=" detail.logo.indexOf('http')== -1? baseUrl + detail.logo : detail.logo" v-if="detail.logo" alt="">
                            <img src="../../../../../assets/photo.png" v-else alt="">
                            <div class="contenBox-left-top-name">{{ detail.name }}</div>
                        </div>
                        <div class="contenBox-left-bottom">
                            <div class="contenBox-left-bottom-item">工作单位：{{ detail.work || '暂无' }}</div>
                            <div class="contenBox-left-bottom-item">所在地区： {{ detail.areaCode || '暂无' }}</div>
                            <div class="contenBox-left-bottom-item">联系方式： {{ detail.tel || '暂无' }}</div>
                            <div class="contenBox-left-bottom-item">联系邮箱： {{ detail.post || '暂无' }}</div>
                        </div>
                    </div>
                    <div class="contenBox-right">
                        <div class="add-box" style="margin-top:3rem;margin-left:4rem">
                            <div class="add-title">简介</div>
                            <!-- <div class="add-btn">查看更多</div> -->
                        </div>
                        <div class="contenBox-right-content">
                            {{ detail.remark }}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import headerBox from '../../../../../components/header.vue';
import headerImg from '../../../../../components/headerImg.vue';
import footerBox from '../../../../../components/footer-box.vue';
import moreBtn from '../../../../../components/more-btn.vue';
import { messageAdd, getMessageDet } from '../../../../../api/message.js';
import {
    getAgentInfo
} from "../../../../../api/gain.js"
import { baseUrl } from '../../../../../../config';
export default {
    components: {
        headerBox,
        headerImg,
        footerBox,
        moreBtn
    },
    data() {
        return {
            baseUrl,
            detail: {},
            ifChat: false,
            chatData: {},
            chatList: [],
            chatCon: null,
            msgId: null,
            userId: localStorage.getItem("userId")
        }
    },
    mounted() {
        if (this.$route.query.id) {
            this.id = this.$route.query.id;
        }
        this.init();
    },
    methods: {
        init() {
            getAgentInfo({ id: this.id }).then(res => {
                if (res.code === 200) {
                    this.detail = res.data;
                }
            })
        },
        gotoChat(v) {
            this.chatData = v;
            this.ifChat = true;
            this.msgId = v.id;
            this.getChatDet(v.id);
        },
        getChatDet(id) {
            getMessageDet({ receiveId: id, receiveType: '2' }).then(res => {
                if (res.code === 200) {
                    this.chatList = res.data;
                    this.$nextTick(() => {
                        let scrollEl = this.$refs.mianscroll;
                        scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: 'smooth' });
                    });
                }
            })
        },
        chatSub() {
            if (this.chatCon) {
                messageAdd({
                    receiveType: 2,//1 投资人  2 经纪人 3融资需求
                    content: this.chatCon,
                    receiveId: this.msgId,
                }).then(res => {
                    if (res.code === 200) {
                        this.chatCon = null;
                        this.getChatDet(this.msgId);
                    }
                })
            }
        },
        gotoHome() {
            this.$router.push({
                path: '/bigScreenIndex',
            })
        },
        backToOne() {
            console.log('11');
            this.$router.go(-1)
        },
        goBack() {
            this.$router.push('/chart')
        }
    }
}
</script>

<style scoped lang="scss">
@font-face {
    font-family: "ffa";
    src: url(../../../assets/bigScreen/fonts/DS-DIGIB.TTF);
}
ul,
li {
    list-style: none;
}
.big-box {
    background-color: #071c3b;
    height: 100vh;
}
.header {
    position: relative;
    text-align: center;
    position: relative;
    height: 19.1rem;

    .backBox {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 70rem;
        height: 10rem;
        cursor: pointer;
    }

    > img {
        width: 100%;
        max-height: 100%;
        margin-top: -1.1rem;
        image-rendering: -moz-crisp-edges; /* Firefox */
        image-rendering: -o-crisp-edges; /* Opera */
        image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
    }
}
.centerBox {
    width: 96%;
    margin: 0 auto;
    position: absolute;
    top: 14rem;
    left: 2%;
    .sreenTitle {
        background-image: url("../../../../../assets/bigScreen/sreenTitle.png");
        background-size: 100% 100%;
        height: 3.8rem;
        padding-left: 35px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
    }
    .center {
        margin-top: 1rem;
        height: calc(100vh - 20rem);
        border: 1px solid;
        border-image: linear-gradient(
                130deg,
                #2385df 0%,
                rgba(35, 133, 223, 0.65) 92%
            )
            1;
        overflow-y: scroll;
        padding: 20px;
        .contenBox {
            display: flex;
            justify-content: space-between;
            width: 140rem;
            min-height: 46rem;
            border-radius: 8px;
            // background: #FFFFFF;
            border: 1px solid #4494ff46;
            margin: 3rem auto 5rem;

            .contenBox-left {
                width: 50rem;
                // height: 100%;
                border-right: 1px solid #4494ff46;

                .contenBox-left-top {
                    display: flex;
                    justify-content: left;
                    align-items: center;
                    height: 15rem;
                    border-bottom: 1px solid #4494ff46;
                    padding: 2.8rem 4rem;

                    img {
                        width: 10rem;
                        height: 10rem;
                        border-radius: 50%;
                    }

                    .contenBox-left-top-name {
                        font-size: 2.4rem;
                        color: rgba(255, 255, 255, 0.85);
                        margin-left: 3rem;
                    }
                }

                .contenBox-left-bottom {
                    display: flex;
                    justify-content: space-between;
                    flex-wrap: wrap;
                    padding: 5rem 4rem;

                    .contenBox-left-bottom-item {
                        width: 100%;
                        padding-bottom: 2rem;
                        color: rgba(255, 255, 255, 0.85);
                        font-size: 1.6rem;
                    }
                }
            }

            .contenBox-right {
                width: 90rem;

                .add-box {
                    width: 90rem;
                    height: 6.5rem;
                    margin: 0 auto;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;

                    .add-title {
                        display: flex;
                        align-items: center;
                        font-size: 2.2rem;
                        font-weight: bold;
                        color: rgba(255, 255, 255, 0.85);

                        &::before {
                            content: "";
                            display: block;
                            width: 0.5rem;
                            height: 3rem;
                            background: #037aff;
                            margin-right: 1rem;
                        }
                    }

                    .add-btn {
                        width: 13rem;
                        height: 4.5rem;
                        text-align: center;
                        line-height: calc(4.5rem - 4px);
                        border-radius: 4px;
                        border: 1px solid #037aff;
                        font-size: 1.6rem;
                        color: #037aff;
                        cursor: pointer;
                    }
                }

                .contenBox-right-content {
                    padding: 3.5rem 4rem;
                    color: rgba(255, 255, 255, 0.85);
                    font-size: 1.6rem;
                    text-indent: 2em;
                }
            }
        }
    }
    ::-webkit-scrollbar {
        width: 5px;
        height: 10px;
    }

    /* 滚动条轨道 */
    ::-webkit-scrollbar-track {
        background-color: #234470;
    }

    /* 滚动条滑块 */
    ::-webkit-scrollbar-thumb {
        background-color: #061c57;
    }

    /* 鼠标悬停在滚动条上的滑块 */
    ::-webkit-scrollbar-thumb:hover {
        background-color: #555;
    }
}
.backToBox {
    position: absolute;
    top: 8rem;
    right: 2%;
    display: flex;
    z-index: 10;
    .backTo {
        background-image: url("../../../../../assets/bigScreen/backTo.png");
        color: #2dccff;
        background-size: 100% 100%;
        width: fit-content;
        padding: 2px 40px 10px 10px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 10px;
        div {
            padding-top: 5px;
        }
    }
}
</style>
